<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up(){
		Schema::create('users', function(Blueprint $table){
			$table->increments('id');
			$table->string('username', 60)->comment('用户名，可用于登陆');
			$table->string('real_name', 60)->nullable()->comment('用户的真实姓名，属于用户信息');
			$table->string('identify_number', 20)->nullable()->comment('学号或工作号');
			$table->string('email', 255)->comment('用户的电子邮箱地址，可用于登陆');
			$table->string('password', 64)->comment('用户密码，加密后存放');
			$table->string('description', 255)->nullable()->comment('用户的个人简介');

			$table->integer('role_id')->comment('用户的角色id，外键');
			$table->integer('unit_id')->nullable();

			$table->boolean('activated')->default('1')->comment('可否活动，若为0则被锁定不允许登陆');
			$table->string('remember_token', 60)->nullable();
			$table->string('head_image', 60)->default('default-header.jpg')->comment('用户的头像文件名');

			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down(){
		Schema::drop('users');
	}

}
